//判断是否为原二叉树子结构
public class TreeSubStructure {
}
class TreeSubStructureSolution {
    public boolean isSubStructure(TreeNode A, TreeNode B) {
        if(B==null)return A==null;
        if(A==null)return B==null;
        if(A.val==B.val&&isValid(A,B))return true;
        return isSubStructure(A.left,B)|isSubStructure(A.right,B);
    }
    boolean isValid(TreeNode a,TreeNode b){
        if(b==null)return true;
        else if(a==null)return false;
        else if(a.val!=b.val)return false;
        else return isValid(a.left,b.left)&&isValid(a.right,b.right);
    }
}